# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test06
# Description:  例8.6
# Author:       ASUS
# Date:         2019/3/11
#-------------------------------------------------------------------------------

class Calculator:
    def calculate(self,expression):
        self.value = eval(expression)            #eval执行求值字符串
    def printResult(self):
        print("result:{}".format(self.value))
class MyPrint:
    def printResult(self):
        print("计算结果:{}".format(self.value))

# 写在前面的父类会覆盖写在后面父类的同名方法
class NewCalculator(Calculator,MyPrint):
    pass
class NewCalculator1(MyPrint,Calculator):
    pass

calc = NewCalculator()
calc.calculate("1+3*5")
calc.printResult()
print(NewCalculator.__bases__)
calc1 = NewCalculator1()
calc1.calculate("1+3*5")
calc1.printResult()
print(NewCalculator1.__bases__)

